import request from '@/utils/request'

// 查询角色列表
export function listRoleApi(data) {
  return request.post('/system/role/list', data)
}

// 查询角色详细
export function infoRoleApi(roleId) {
  return request.get('/system/role/info', { id: roleId })
}

// 新增角色
export function addRoleApi(data) {
  return request.post('/system/role/add', data)
}

// 修改角色
export function editRoleApi(data) {
  return request.post('/system/role/edit', data)
}

// 删除角色
export function delRoleApi(roleId) {
  return request.post('/system/role/delete', { id: roleId })
}

// 导出
export function exportRoleApi(data) {
  request.download('/system/role/export',data)
}

// 角色可选择列表
export function selectRoleApi() {
  return request.get('/system/role/get-select')
}


// 角色数据权限
export function saveDataScopeApi(data) {
  return request.post('/system/role/data-scope', data)
}

// 角色状态修改
export function changeStatusApi(roleId, status) {
  return request.post('/system/role/status', { id: roleId, status: status })
}


// 查询角色已授权用户列表
export function authUsersListApi(data) {
  return request.post('/system/role/auth-list', data)
}

// 查询角色未授权用户列表
export function unAuthUsersListApi(data) {
  return request.post('/system/role/get-admin-auth', data)
}

// 授权用户选择
export function authUserAppendApi(roleId, adminIds) {
  return request.post('/system/role/auth-append', { roleId: roleId, adminIds: adminIds })
}

// 取消用户授权角色
export function cancelAuthUserApi(roleId, adminIds) {
  return request.post('/system/role/auth-remove', { roleId: roleId, adminIds: adminIds })
}
